package com.cat.math;

/**
 * @author 曲大人的喵
 * @description https://leetcode.cn/problems/rotate-image/description/?envType=problem-list-v2&envId=math
 * @create 2025/9/22 10:45
 * @since JDK17
 */

public class Solution03 {
    public void rotate(int[][] matrix) {
        int n = matrix.length;
        for (int i = 0; i < n / 2; i++) {
            for (int j = 0; j < (n + 1) / 2; j++) {
                int t = matrix[i][j];
                matrix[i][j] = matrix[n - i - 1][j];
                matrix[n - i - 1][j] = matrix[n - i - 1][n - j - 1];
                matrix[n - i - 1][n - j - 1] = matrix[i][n - j - 1];
                matrix[i][n - j - 1] = t;
            }
        }

    }
}
